package com.llmcu.graphic.designpatterns.command.test;

import java.awt.*;

public class MyCanvas extends Canvas implements MyDrawable{
    private Color graphicsColor;
    private int radius;

    private Color bgColor;
    private int width;
    private int height;

    public MyCanvas(Color graphicsColor, int radius, Color bgColor, int width, int height) {
        this.radius = radius;
        this.graphicsColor = graphicsColor;

//        Graphics graphics = this.getGraphics();
//        graphics.setColor(graphicsColor);

        this.setSize(width,height);
        this.setBackground(bgColor);
    }

    @Override
    public void draw(int x, int y) {
        Graphics graphics = this.getGraphics();
        graphics.setColor(graphicsColor);
        graphics.fillOval(x-radius,y-radius,radius*2,radius*2);
    }
}
